package GUI;

import gameEngine.Game;

import java.util.ArrayList;

@SuppressWarnings("serial")
public class PokerTable extends ArrayList<Player>{

	private String name;
	private PokerBoard board;
	private Game game;
	private Deck deck;
	
	public PokerTable(PokerBoard board, Game game){
		super();
		Player owner = board.getOwner();
		this.add(owner);
		this.board = board;
		this.name = owner.getName() + "\'s table";
		this.game = game;
		this.deck = new Deck();
	}
	@Override
	public String toString(){
		return name;
	}
	public PokerBoard getBoard(){
		return board;
	}
	public Card[] flop(){
		return deck.flop();
	}
	public Card[] nextFaceUp(){
		return deck.nextFaceUp();
	}
	public Card nextCard(){
		return deck.nextCard();
	}
	public Card nextDeal(){
		return Card.faceDownCard(nextCard());
	}
	public boolean joinTable(Player player){
		if(game != null){
			this.add(player);
			player.joinGame(game);
			return true;
		}
		return false;
	}
}
